import { Mt, MtEntity } from '../mt'
import { IMcc } from '../type'
import { InteractiveModel } from './interface'

/** 除vip外 排序 权重 */
export function getWeightExceptVip(mcc: IMcc) {
	let weight = 0
	if (mcc.status.isDoubleFlow) {
		weight += 1000
	}
	if (mcc.status.isSpeaker) {
		weight += 100
	}
	if (mcc.isMt && mcc.status.isChairman) {
		weight += 10
	}
	if (mcc.status.isOnline) {
		weight += 1
	}
	return weight
}
export const transInteractive = (mcc: MtEntity): InteractiveModel => {
	const mt = new Mt(mcc)
	return {
		mcc: mt,
		status: {
			isChecked: false,
			isMatchSearch: true,
			isCalling: false,
		},
		attr: {
			weightExceptVipInSortType2: getWeightExceptVip(mt),
		},
		mtKey: mt.mtKey,
	}
}
